/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package br.ufrn.generativemodel.generativemodel.impl;

import br.ufrn.generativemodel.generativemodel.Field;
import br.ufrn.generativemodel.generativemodel.GenerativemodelPackage;
import br.ufrn.generativemodel.generativemodel.Method;

import java.util.Collection;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.util.EObjectResolvingEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Field</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link br.ufrn.generativemodel.generativemodel.impl.FieldImpl#getMethodReverseDependences <em>Method Reverse Dependences</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class FieldImpl extends AbstractDataImpl implements Field {
	/**
	 * The cached value of the '{@link #getMethodReverseDependences() <em>Method Reverse Dependences</em>}' reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getMethodReverseDependences()
	 * @generated
	 * @ordered
	 */
	protected EList<Method> methodReverseDependences;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected FieldImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return GenerativemodelPackage.Literals.FIELD;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<Method> getMethodReverseDependences() {
		if (methodReverseDependences == null) {
			methodReverseDependences = new EObjectResolvingEList<Method>(Method.class, this, GenerativemodelPackage.FIELD__METHOD_REVERSE_DEPENDENCES);
		}
		return methodReverseDependences;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case GenerativemodelPackage.FIELD__METHOD_REVERSE_DEPENDENCES:
				return getMethodReverseDependences();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case GenerativemodelPackage.FIELD__METHOD_REVERSE_DEPENDENCES:
				getMethodReverseDependences().clear();
				getMethodReverseDependences().addAll((Collection<? extends Method>)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case GenerativemodelPackage.FIELD__METHOD_REVERSE_DEPENDENCES:
				getMethodReverseDependences().clear();
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case GenerativemodelPackage.FIELD__METHOD_REVERSE_DEPENDENCES:
				return methodReverseDependences != null && !methodReverseDependences.isEmpty();
		}
		return super.eIsSet(featureID);
	}

} //FieldImpl
